<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<div class="page-sidebar nav-collapse collapse">

	<ul class="page-sidebar-menu">
		<li>
			<div class="sidebar-toggler hidden-phone"></div>
		</li>
		<li class="start <c:if test="${_menuId0==0 || _menuId0==null}">active</c:if>">
			<a href="<c:url value="/home.html?_menu=0"/>">
			<i class="icon-home"></i> 
			<span class="title">首页</span>
			<c:if test="${_menuId0==0 || _menuId0==null}">
				<span class="selected"></span>
			</c:if>
			</a>
		</li>
		
		<c:set var="_menu0List" value="${_menus[0] }"/>
		<c:set var="_menu1List" value="${_menus[1] }"/>
		<c:set var="_menu2List" value="${_menus[2] }"/>
		
		<%-- 一级菜单 --%>
		<c:forEach items="${_menu0List }" var="menu0">
			<li class="<c:if test="${_menuId0==menu0.id}">active</c:if>">
				<a href="javascript:;">
					<i class="${menu0.icon}"></i> 
					<span class="title">${menu0.title }</span>
					<c:if test="${_menuId0==menu0.id}">
						<span class="selected"></span>
					</c:if>
					<span class="arrow <c:if test="${_menuId0==menu0.id}">open</c:if>"></span>
				</a>
				<%-- 是否有二级菜单 --%>
				<c:if test="${menu0.hasChild==true }">				
					<ul class="sub-menu">
						<%-- 循环二级菜单 --%>
						<c:forEach items="${_menu1List}" var="menu1">
							<%-- 父级为一级菜单时显示二级菜单内容 --%>
							<c:if test="${menu0.id==menu1.parentId }">
								<li <c:if test="${_menuId1==menu1.id}">class="active"</c:if> >
									<%-- 是否有三级菜单 --%>
									<c:choose>
										<c:when test="${menu1.hasChild==true }">
											<a href='<c:url value="${menu1.path}"><c:param name="_menu">${menu0.id},${menu1.id}</c:param></c:url>'>
												<i class="${menu1.icon}"></i> ${menu1.title }<span class="arrow"></span>
											</a>
											<ul class="sub-menu">
												<%-- 循环三级菜单 --%>
												<c:forEach items="${_menu2List }" var="menu2">
												
													<c:if test="${menu1.id==menu2.parentId }">
														<li <c:if test="${_menuId2==menu2.id}">class="active"</c:if> >
															<a href='<c:url value="${menu2.path}"><c:param name="_menu">${menu0.id},${menu1.id},${menu2.id}</c:param></c:url>'>
																<i class="${menu2.icon}"></i> ${menu2.title }
															</a>
														</li>
													</c:if>
												</c:forEach>
											</ul>
										</c:when>
										<c:otherwise>
											<a href='<c:url value="${menu1.path}"><c:param name="_menu">${menu0.id},${menu1.id}</c:param></c:url>'>
												<i class="${menu2.icon}"></i> ${menu1.title }
											</a>
										</c:otherwise>
									</c:choose>
								</li>
							</c:if>
						</c:forEach>
					</ul>
				</c:if>
			</li>
		</c:forEach>
	</ul>
</div>
